package enums;

import org.junit.Test;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : EnumTest
 * @Author : 54061
 * @Date: 2022/2/28 18:39
 */
/*
枚举类的格式
public enum 类名{
枚举项1,
枚举项2,
枚举项3;
}

        常用方法 :
        枚举类.values(): 获取当前枚举的所有的枚举项
        枚举类.value(String name): 通过枚举项的name获取指定的枚举项
        枚举项.name(): 获取某个枚举项的名字
 */
public class EnumTest {
    @Test
    public void test01(){
              /*Employee employee1 = new Employee("张三", Gender.MALE);
        Employee employee2 = new Employee("张三", Gender.FEMALE);*/
        Gender male = Gender.MALE;
        //male.setName("男");
        /*System.out.println(male.getName());
        System.out.println(male.name());*/
        Gender[] genders = Gender.values();
        for (Gender gender : genders) {
            System.out.println(gender);
        }
        Gender other = Gender.valueOf("OTHER");
        System.out.println(other);
        int ordinal = male.ordinal();
        System.out.println(ordinal);
    }

}

